﻿Public Class MedicionDeTemperatura
    Private _gradosCelsius As Double
    Public Property Celsius() As Double
        Get
            Return _gradosCelsius
        End Get
        Set(ByVal value As Double)
            _gradosCelsius = value
        End Set
    End Property

    Public Property Fahrenheit() As Double
        Get
            Return _gradosCelsius * 1.8 + 32
        End Get
        Set(ByVal value As Double)
            _gradosCelsius = (value - 32) / 1.8
        End Set
    End Property

    Public Property Kelvin() As Double
        Get
            Return _gradosCelsius + 273.15
        End Get
        Set(ByVal value As Double)
            _gradosCelsius = value - 273.15
        End Set
    End Property

    Shared Operator +(ByVal medicion1 As MedicionDeTemperatura, ByVal medicion2 As MedicionDeTemperatura) As MedicionDeTemperatura
        Dim medicionResultante As New MedicionDeTemperatura()
        medicionResultante.Celsius = medicion1.Celsius + medicion2.Celsius
        Return medicionResultante
    End Operator

    Shared Operator -(ByVal medicion1 As MedicionDeTemperatura, ByVal medicion2 As MedicionDeTemperatura) As MedicionDeTemperatura
        Dim medicionResultante As New MedicionDeTemperatura()
        medicionResultante.Celsius = medicion1.Celsius - medicion2.Celsius
        Return medicionResultante
    End Operator
End Class
